package com.kly.user.db.dao.impl;
import com.fqgj.common.base.AbstractBaseMapper;
import com.google.common.collect.Maps;
import com.kly.user.db.dao.UserAppsflyerFromAppDao;
import com.kly.user.db.entity.UserAppsflyerFromAppEntity;
import org.springframework.stereotype.Repository;

import java.util.HashMap;

/**
* User: linqu
* Date: 2024-06-05
* Time: 10:53:51.064
*/

@Repository
public class UserAppsflyerFromAppDaoImpl extends AbstractBaseMapper<UserAppsflyerFromAppEntity> implements UserAppsflyerFromAppDao {
    @Override
    public UserAppsflyerFromAppEntity getAppsflyerFromInfo(String userCode, String afid) {
        final HashMap<String, Object> params = Maps.newHashMap();
        params.put("userCode", userCode);
        params.put("afid", afid);
        return this.getSqlSession().selectOne(this.getStatement("getAppsflyerFromInfo"), params);
    }

    @Override
    public UserAppsflyerFromAppEntity getAppsflyerFromInfoByUserCode(String userCode) {
        final HashMap<String, Object> params = Maps.newHashMap();
        params.put("userCode", userCode);
        return this.getSqlSession().selectOne(this.getStatement("getAppsflyerFromInfoByUserCode"), params);
    }

    @Override
    public UserAppsflyerFromAppEntity addAppsflyerFromInfo(String userCode, String appflyersId, int type) {
        UserAppsflyerFromAppEntity entity = new UserAppsflyerFromAppEntity();
        entity.setUserCode(userCode);
        entity.setAppsflyerId(appflyersId);
        entity.setType(type);
        return this.insert(entity);
    }
}